package com.alipay.config;
import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016092900620970";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key =
            "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC0vAS5ih3NdFJH1Zm5RNd5WxCKYSGzEsNzyeu4czo3Hl24kppEHEsKnXU0VSZpEsJ8BGGnHVms67KyobrQyUVnRXJX" +
                    "/JkWs1OB/dChrw6syABGwxMtkZmx6PeNiee/e0ifpFnHDRZnBb5Pw5GN/xytcQDk5N5lvvOmwGUO50fUPvemWRuDs043NKSezL3JMDNeiMn040yOlGKKEIThvswpLLsmmn" +
                    "/2hf3ou8yIZezsYNuzN6g9VyIkE4k+NdrYXrWs/YQH1K1NqoGm6RXU9Iba" +
                    "+AtEe1Pgit0FYidQAMaLRjZ4fhDlsquItQnW76zMcuxQPPiLO7fsZsSJKgFwCBIrAgMBAAECggEASIMfCinl5yaCVJvYf0KliOUGb96knKosjOo4jtp8Qt0GESWQiz8mxG2ENqjrLkD+kq9XVqsp7XzrR0woHdiC5fow9Cg+a6MrH/5rlFMd+iiMI9fke+Xs2jp0B++KcYLPEm3oLzqLAG6Heo0meugd42BxUWSZ7gx8ySxr31zfrsGf2ynZHIdlSGW1Y9n3/R7Ypqjdm8ZKOX3rr2ZAxVoRPhLoTwV51cP2OzXwpxcNkWgBRArzdgXOVCk2J+uP6F1XY4ty/9PfoAbNwm5uNv9ShEVE7GZwKAEf8LKoiLjjJBKC1L54UuQzq8MWBFx4cvDIxtnwoMd616X5+LbvFywO0QKBgQDiVmVoNKwCoo52xiMhjN6ACwx6x59En2T4gKUg19j6Bc3eCkTQxKw9YOC6V3tw61bpadT7VsLfqM6i0BcAgWQ8yqBL5iuePB1v+hcJ5bKn2cruuhhxn0ayMzA69WfypXVnnyx2hxEMpPMNB2S9IclC8WuoRRu9ZRkoq/iGrCzkhQKBgQDMa6Tp3a0kIdT0BLb4QBGypj8vBakSZJnHaYjUukmcFQmhaOuwcsXLDb6QsQGmWfjh3wbPjTWQNu0s1JDsGVtARShT4uSrGYLPL2sNYZAsWhGL+5V8hzyS3MM2VaMhO0053/wrHLaMN10ayKAYMaGpS8lQyux6gf+vY0n6NYXy7wKBgC5+3xAcGeXkrO17YIYo4SBepK6oSXCYae6exs1LahhajuL5Kw/UByoIt8Gv7PzSa6VBh24mcZvumpxZsQ/6hLP0UB+nZfh4kveI4ai31g6jMAwAkLrupGBBIbxK45K2KLsjuMeUkY0OaZuYlDpCMY0d+Sa1I7CxjwyK32ATCJndAoGALCYLZd7UZ/tOjKz//zmHGPhCqRsl2q0TcTffr2HUR/tbKxsH3AHNqf776y/vVUgVMmMCi4zJxq22J3p5GiSXypelEAjure1CjRCGpEsv4gRJydu5+z0R3f4DwxZXtvOhyCARzBXVbw798qzltpPxgCi3/9Tzobm1yOE+tuUcWs0CgYEAw/bQTf4aP2nEo3f6B+6ddDyclE0Edz3xfdaRBl6iiktLwqgLEyP+RscyKECjnJKoaoEFcoeCAqTNryjLhb92M9++Q1cZubRra6SQYWFHAOVDWa0hsjIW34YpUaamIH78eXyXJ21SeHfWcb8AewJ9J6HEdJYP5l122tDetpJLwwE=";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key =
            "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtLwEuYodzXRSR9WZuUTXeVsQimEhsxLDc8nruHM6Nx5duJKaRBxLCp11NFUmaRLCfARhpx1ZrOuysqG60MlFZ0VyV" +
                    "/yZFrNTgf3Qoa8OrMgARsMTLZGZsej3jYnnv3tIn6RZxw0WZwW+T8ORjf8crXEA5OTeZb7zpsBlDudH1D73plkbg7NONzSknsy9yTAzXojJ9ONMjpRiihCE4b7MKSy7Jpp" +
                    "/9oX96LvMiGXs7GDbszeoPVciJBOJPjXa2F61rP2EB9StTaqBpukV1PSG2vgLRHtT4IrdBWInUADGi0Y2eH4Q5bKriLUJ1u+szHLsUDz4izu37GbEiSoBcAgSKwIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://27.156.62.172:8080/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://27.156.62.172:8080/alipay.trade.page.pay-JAVA-UTF-8/return_url.jsp";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "D:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     *
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis() + ".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}